<template>
  <div>
    <nav-bar title="签到详情"></nav-bar>
    <div class="maxinBox" v-if="data">
        <van-cell title="加班人员" :value="data.builderName || '--'"></van-cell>
        <van-cell title="加班地点" :value="data.checkPointName || '--'"></van-cell>
        <van-cell class="marginTop5" title="签到时间" :value="data.checkTime | formatDate('YYYY-MM-DD')"></van-cell>
        <van-cell title="加班内容" :value="data.overTimeContent || '--'"></van-cell>
        <van-cell title="附件"/>
        <van-row>
          <van-col :span="8">
            <div style="padding: 1.25rem 0.625rem">
              <img style="width: 100%;" :src="data.attachmentUrl" @click="bigAvatar(data.attachmentUrl)">
            </div>
          </van-col>
        </van-row>
    </div>
  </div>
</template>

<script>
  import moment from 'moment'
  import {ImagePreview} from 'vant'
  import signManage from '../../../../api/workAPI/signManage.js'
  export default {
    data() {
      return {
        data: null
      }
    },
    methods: {
      // 放大图片
      bigAvatar(img) {
        ImagePreview({
           images: [img],
        })
      },
      getHistoryData() {
        let projectId = localStorage.getItem('projectId')
        let date = moment(JSON.parse(localStorage.getItem('historyData')).checkTime).format('YYYY-MM-DD')
        let checkType = JSON.parse(localStorage.getItem('historyData')).checkType
        signManage.getHistoryData(projectId, date, checkType).then(res => {
          this.data = res
        })
      },
    },
    mounted() {
      this.getHistoryData()
    }
  }
</script>
<style scoped lang="scss">

</style>
